<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <title>应急信息发布项目维护查看</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link href="../../layui/css/iconfont/iconfont.css" rel="stylesheet" type="text/css">
    <link href="../../layui/css/layui.css" rel="stylesheet" type="text/css">
    <link href="../../css/style.css" rel="stylesheet" type="text/css">
    <script src="../../layui/layui.js"></script>
    <script src="../../js/jquery-1.8.3.js"></script>
    <script src="../../js/util.js"></script>
    <script>
        layui.use(['table', 'form', 'jquery', 'element','layer','laydate'], function () {
            var table = layui.table;
            var form = layui.form;
            var $ = layui.$;
            var layer=layui.layer;
            var laydate = layui.laydate;
            var user;
            var mgrId = getUrlParam("mgrId");
            var reset = 0;
            var smsRealtimeControl;
	        laydate.render({
	             elem: '#startTime'
	             , type: 'datetime'
	        });
	        laydate.render({
	             elem: '#endTime'
	             , type: 'datetime'
	        });
             $('#ditubtn').on('click', function () {
	            var cityId=$("#cityId").val();
	            var mgrId=$("#xiangmuid").val();
	            var regionId=$("#quyuid").val();
	            var regionType=$("#quyutype").val();
	            var regionTypeValue=$("#quyudetail").val();
	            if(isNull(cityId)){
                    layer.msg("地市为空");
                    return false;
                }
                if(isNull(regionId)){
                    layer.msg("区域id为空");
                    return false;
                }
                if(isNull(regionType)){
                    layer.msg("区域类型为空");
                    return false;
                }
                if(isNull(regionTypeValue)){
                    layer.msg("区域值为空");
                    return false;
                }
	            var url="/mapManageView.html?cityId="+cityId+"&regionId="+regionId+"&regionType="+regionType+"&regionTypeValue="+regionTypeValue;
                url=encodeURI(url); 
	            layer.open({
                    title: '发送区域展示',
                    type: 2,
                    content: url,
                    area: ['1000px', '550px'],
                    scrollbar: true
                });
            });
            
            var quxianName;
            //获取区县名称
			function getCountyName(countyId) {
			    var url = '/util/getCountyName?countyId='+countyId;
			    $.ajax({
			            url: url,
			            type: 'post',
			            success: function (json) {
			                quxianName = json.data;
			                $('#regionTypeValueCounty').html(quxianName);
			            }, error: function () {
			                layer.msg('系统异常，请联系管理员处理!');
			            }
			        }
			    );
			}
            
            //页面数据初始化
            $(document).ready(function () {
           
                var url = '/mgrTemplate/findMgrTemplateByMgrId';
                var param = {
                    mgrId: mgrId
                };
                $.ajax({
                    type: 'post',
                    async: false,
                    url: url,
                    data: param,
                    beforeSend: function () {
                        loading = layer.load(0, {shade: false});
                    },
                    success: function (json) {
                        layer.close(loading);
                        var data = json.data;
                        smsRealtimeControl = data.smsRealtimeControl;
                        $("#cityId").val(data.cityId);
                        $("#countyId").val(data.countyName);
                        if(data.cityExtId.length==5){
                            $("#extId").val(data.cityExtId.substring(data.cityExtId.length-3));
                        }
                     	$("#name").val(data.name);
                     	$("#startTime").val(data.startDate);
                     	$("#endTime").val(data.endDate);
                        $("#content").val(data.content);
                        $("#xiangmuid").val(mgrId);
                        $("#quyuid").val(data.regionId);
                        $("#quyutype").val(data.regionType);
                        $("#quyudetail").val(data.regionTypeValue);
                        $("#cycleThreshold").val(data.cycleThreshold);
                        $("#threshold").val(data.threshold);
                        if(data.regionType=="1"){
                            $("#regionType").val("组合选择行政区域");
                            $('#ditubtn').attr("style","display:none");
                            getCountyName(data.regionTypeValue);
                            
                            
                        }else{
                            $("#regionType").val("基于GIS地图画范围"); 
                            $('#ditubtn').attr("style","display:block");
                            $('#regionTypeValueCounty').attr("style","display:none");
                        }
                     	if(data.isLocal=="0"){
                     	    $("#isLocal").val("本地");
                     	    $("#localDate").val(data.localDate+"天");
                     	}else if(data.isLocal=="1"){
                     	    $("#isLocal").val("外地");
                     	    $("#localDate").val(data.localDate+"天");
                     	}else if(data.isLocal=="2"){
                     	    $("#isLocal").val("本地+外地");
                     	    $("#localDate").val(data.localDate+"天");
                     	}
                     	
                     	var cycleMsg;
                        if (data.isThreshold == 0) {
                            cycleMsg = "没有设置阀值";
                        } else if (data.isThreshold == 1) {
                            cycleMsg = "发送总量为" + data.threshold + "条";
                        } else if (data.isThreshold == 2) {
                            if (data.cycle == 1) {
                                cycleMsg = "发送量为每年" + data.cycleThreshold + "条";
                            }
                            if (data.cycle == 2) {
                                cycleMsg = "发送量为每月" + data.cycleThreshold + "条";
                            }
                            if (data.cycle == 3) {
                                cycleMsg = "发送量为每周" + data.cycleThreshold + "条";
                            }
                            if (data.cycle == 4) {
                                cycleMsg = "发送量为每日" + data.cycleThreshold + "条";
                            }
                            if (data.cycle == 5) {
                                cycleMsg = "发送量为" + data.cycleThreshold + "条,时间范围:" +
                                    data.thresholdStartTime + "至" + data.thresholdEndTime;
                            }
                        } else if (data.isThreshold ==3) {
                            if (data.cycle == 1) {
                                cycleMsg ="发送总量为" + data.threshold + "条,周期发送量为每年" + data.cycleThreshold + "条";
                            }
                            if (data.cycle == 2) {
                                cycleMsg = "发送总量为" + data.threshold + "条,周期发送量为每月" + data.cycleThreshold + "条";
                            }
                            if (data.cycle == 3) {
                                cycleMsg = "发送总量为" + data.threshold + "条,周期发送量为每周" + data.cycleThreshold + "条";
                            }
                            if (data.cycle == 4) {
                                cycleMsg = "发送总量为" + data.threshold + "条,周期发送量为每日" + data.cycleThreshold + "条";
                            }
                            if (data.cycle == 5) {
                                cycleMsg = "发送总量为" + data.threshold + "条,周期发送量为" + data.cycleThreshold + "条,时间范围:" +
                                    data.thresholdStartTime + "至" + data.thresholdEndTime;
                            }
                        }
                        $("#threshold").text(cycleMsg);
                        form.render();
                    },
                    error: function (data) {
                        layer.msg('系统异常，请联系管理员处理!');
                    }
                });
            });
        });
    </script>
</head>
<body>
<div class="layui-html-limit">
    <!--container-->
    <div class="layui-content-body">
        <div class="scroll-box">
            <div class="breadcrumb-box">
              <span class="layui-breadcrumb" lay-separator="|">
                  <a href="javascript:returnIndex2()">首页&nbsp;</a>
                  <a href="#"> &nbsp;项目维护管理&nbsp; </a>
                  <a href="#"> &nbsp;短信项目维护&nbsp;</a>
                  <a href="#"> &nbsp;短信项目维护查看&nbsp; </a>
              </span>
            </div>
            <div class="content-box">
                <div class="layui-form layui-form-pane">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label" style="width:120px;">省份</label>
                            <div class="layui-input-block" style="width:180px;margin-left:120px;">
                                <input type="text" name="province" lay-verify="required" value="江苏"
                                       autocomplete="off" class="layui-input" disabled >
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label"  style="width:120px;">地市</label>
                            <div class="layui-input-block" style="width:180px;margin-left:120px;">
                                <select name="cityId" lay-filter="cityId" id="cityId" disabled>
                                    <option value="">请选择</option>
                                    <option value="11">苏州</option>
                                    <option value="12">淮安</option>
                                    <option value="13">宿迁</option>
                                    <option value="14">南京</option>
                                    <option value="15">连云港</option>
                                    <option value="16">徐州</option>
                                    <option value="17">常州</option>
                                    <option value="18">镇江</option>
                                    <option value="19">无锡</option>
                                    <option value="20">南通</option>
                                    <option value="21">泰州</option>
                                    <option value="22">盐城</option>
                                    <option value="23">扬州</option>
                                    <option value="25">省级</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label"  style="width:120px;">区县</label>
                            <div class="layui-input-block" style="width:180px;margin-left:120px;">
                                <input type="text" class="layui-input" name="mgrcountyId" lay-filter="countyId" id="countyId" disabled />
                            </div>
                        </div>
                    </div>
                    
                    <div class="layui-form-item" >
							<div class="layui-block" pane="">
								<label class="layui-form-label" style="width:120px">项目名称</label>
								<div class="layui-input-block"  style="width:180px;margin-left:120px;">
									<input type="text" id="name" name="name" autocomplete="off"
										class="layui-input" disabled style="width:auto">
								</div>
							</div>
				     </div>
                    <!-- 
			            <div class="layui-block">
			                <label class="layui-form-label" style="width: auto">项目名称</label>
			                <div class="layui-input-block" style="width:150px">
			                    <input type="text" name="name" id="name" required lay-verify="required"
			                           placeholder="请输入项目名称"
			                           autocomplete="off" class="layui-input" disabled>
			                </div>
			            </div>

       
                        <div class="layui-inline ">
				            <label class="layui-form-label">短信扩展码</label>
				            <div class="layui-input-block" style="width:150px">
				                <input type="text" class="layui-input"  name="extId" lay-filter="extId" id="extId" disabled />
				            </div>
				        </div> -->
				      <div class="layui-form-item" >
                        <div class="layui-block">
                            <label class="layui-form-label" style="width: 120px">发送起止时间</label>
                            <div class="layui-input-inline" >
                                <input type="text" name="date" id="startTime" autocomplete="off" class="layui-input" style="width:180px;"
                                       placeholder="请选择" disabled>
                            </div>
                            <div class="layui-form-mid">-</div>
                            <div class="layui-input-inline"  style="width:180px;">
                                <input type="text" name="date" id="endTime" autocomplete="off" class="layui-input" style="width:180px;"
                                       placeholder="请选择" disabled>
                            </div>
                        </div>
                     </div>
                    
                    <div class="layui-block">
                         <label class="layui-form-label" style="width: 120px">发送区域设置</label>
                         
                        <div class="layui-inline">
                         <div class="layui-form-item">
                             <div class="layui-inline">
                                <input type="text" name="regionType" id="regionType" class="layui-input" disabled>
                             </div>
                             <div class="layui-inline">
                                <button class="layui-btn layui-btn-normal" style="margin-left: 10px;" id="ditubtn" >
                                 <i class="layui-icon">&#xe608;</i> 查看区域
                                </button>
                             </div>
                             <div class="layui-inline">
                                <div id="regionTypeValueCounty"></div>
                             </div>
                          </div>
                         </div>
                         
                         <input type="hidden" class="layui-myinput" style="width:100px" id="xiangmuid" value="项目编码" disabled />
                         <input type="hidden" class="layui-myinput" style="width:100px" id="quyuid" value="区域编码" disabled/>
                         <input type="hidden" class="layui-myinput" style="width:100px" id="quyutype" value="区域类型" disabled />
                         <input type="hidden" class="layui-myinput" style="width:200px" id="quyudetail" value="区域范围值" disabled/>
                    </div>
                    <div class="layui-block">
                        <label class="layui-form-label" style="width: 120px">号码发送范围</label>
                        <div class="layui-inline">
                            <div class="layui-form-item">
                            <input type="text" name="isLocal" id="isLocal" class="layui-input" disabled>
                            </div>
                        </div>
                    </div>
						<div class="layui-form-item" id="localTime">
							<div class="layui-block" pane="">
								<label class="layui-form-label" style="width: 120px">发送保存时间</label>
								<div class="layui-input-block" style="width: 180px;margin-left:120px;">
									<input type="text" id="localDate" autocomplete="off"
										class="layui-input" disabled style="width:auto">
								</div>
							</div>
						</div>
                    <div class="layui-form-item">
                        <div class="layui-block" pane="">
                            <label class="layui-form-label" style="width: 120px">短信发送阀值</label>
                            <div class="layui-input-block" style="margin-left:120px;">
                                <!--<input type="text" id="threshold"-->
                                       <!--autocomplete="off" class="layui-input" disabled  style="width:auto">-->
                                <div id="threshold" class="text-autoWidth"></div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-block">
                            <label class="layui-form-label" style="width: 120px">发送短信内容</label>
                            <div class="layui-input-block">
                            	<textarea placeholder="请输入内容" class="layui-textarea" style="width: 50%"
                                      id="content" disabled></textarea>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>